﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ComponentModel;
using LibrarySync2.Common.Enum;
using LibrarySync2.Common.Event;
using LibrarySync2.Common.Extensions;

namespace LibrarySync2.Business.FileSystem.Item
{
    public class Directory : FileSystemItem<DirectoryInfo>
    {
        public Directory()
            : base()
        {
            //Do nothing.  Deserializing.
        }

        internal Directory(DirectoryInfo directoryInfo, string root)
            : base(directoryInfo, root)
        {

        }

        protected override List<FileSystemInfo> GetChildren()
        {
            var result = new List<FileSystemInfo>();
            Item.GetDirectories().ToList<DirectoryInfo>().ForEach(di => result.Add(di));
            Item.GetFiles().ToList<FileInfo>().ForEach(fi => result.Add(fi));
            return result;
        }
    }
}
